Repository navigation
fix(gate): the install-gate refusal names the hazard, not the machinery - #502
Merged
Merged
Conversation
A blocked `git commit -m "… `deployment:env:view` …"` was reported as a false positive. The gate was right: backticks inside DOUBLE quotes are command substitution, so the shell runs the token and splices its output into the argument. Measured — $ bash -c 'echo "... the permission `deployment:env:view` ..."' bash: deployment:env:view: command not found ... the permission ... — the words silently vanish from the message. `indirectInstall` caught a real silent corruption. What was broken is the wording. The refusal named a triage target and offered `kit triage` / `kit pkg`, both nonsense for that command, so the operator concluded kit had mis-parsed a commit message and routed around the gate with -F — hiding a command that would have committed a message with a hole in it. A refusal that misdescribes what it caught trains people to distrust it. Now: the substitution case explains the substitution, says single quotes are literal, and points at `git commit -F <file>`; the "Triage it first" line is appended only when the block really is about an install target. Fail-closed behaviour is unchanged, and a bare-variable indirection ($PM install evil) keeps the generic wording. Tests drive the compiled CLI, because a helper that returns the right sentence to nobody is not a fixed message: exit 2 preserved, wording asserted both ways, and a single-quoted commit message still passes. Both cases are offline by construction — an unresolvable indirection is refused before any registry lookup. Closes #501 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
✅ Docker image built successfully
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #501.
The report was that the gate had a false positive. It did not.
git commit -qam "… naming the permission \deployment:env:view` …"was blocked. Backticks inside **double** quotes are command substitution, so that command never commits that text — the shell runsdeployment:env:view` and splices its output in. Measured:The permission name is silently deleted from the commit message.
indirectInstall(src/install-gate.ts) caught a real silent corruption: argv0 is an unresolvable substitution and an install verb is present, so it cannot verify what runs → fail closed. Single quotes are literal and are not blocked.What was actually broken: the wording
Both lines are about kit's internals, and both are nonsense advice for this command. The reasonable conclusion was "the gate mis-parsed my commit message", and the workaround that follows — write the message to a file, use
-F— hides the defect instead of fixing it. A refusal that misdescribes what it caught teaches people to route around the gate.Now:
and the
Triage it firstline is appended only when the block really is about an install target —$PM install evilkeeps the generic wording.Fail-closed behaviour is untouched: same block, same exit 2. This changes only what the operator is told.
Tests
install-gate.test.ts—explainUnverifiablefor the backtick form, the$( )form (no backtick-specific aside), andnullfor every other unverifiable reason so the generic path is preserved; plus the verdict carrying the hazard, and$PM install evilstill carrying the generic one.gate-bash-refusal.test.ts(new) — the compiled CLI, because a helper that returns the right sentence to nobody is not a fixed message: exit 2 preserved, the hazard wording present,Triage it firstabsent, the generic case unchanged, and a single-quoted commit message allowed. Offline by construction — an unresolvable indirection is refused before any registry lookup, so no network.One test-harness note worth keeping:
execFilehas noinputoption, so the first version of the e2e test left the gate waiting on a stdin pipe that never closed and hung for two minutes.spawnSync({ input })closes it.Verification
npm test: 4350 tests, 0 fail, 0 skipped (macOS, non-root)eslint src: 0 errors;prettier --check "src/**/*.ts"clean🤖 Generated with Claude Code